```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JDK动态代理与CGLIB代理深度解析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8fafc;
            color: #1e293b;
            line-height: 1.6;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
        }
        .code-block {
            background-color: #1e293b;
            border-radius: 8px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        .feature-card {
            transition: all 0.3s ease;
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        }
        .divider {
            height: 2px;
            background: linear-gradient(90deg, rgba(79, 70, 229, 0) 0%, #4f46e5 50%, rgba(79, 70, 229, 0) 100%);
        }
        .drop-cap::first-letter {
            float: left;
            font-size: 3.5rem;
            line-height: 0.65;
            margin: 0.1em 0.1em 0 0;
            color: #4f46e5;
            font-weight: bold;
        }
        .nav-link {
            position: relative;
        }
        .nav-link::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 0;
            height: 2px;
            background-color: #4f46e5;
            transition: width 0.3s ease;
        }
        .nav-link:hover::after {
            width: 100%;
        }
    </style>
</head>
<body>
    <header class="sticky top-0 z-50 bg-white shadow-sm">
        <div class="container mx-auto px-6 py-4">
            <div class="flex justify-between items-center">
                <a href="#" class="text-2xl font-bold text-indigo-600 flex items-center">
                    <i class="fas fa-code mr-2"></i>
                    <span>Java代理研究</span>
                </a>
                <nav class="hidden md:flex space-x-8">
                    <a href="#intro" class="nav-link text-slate-700 hover:text-indigo-600 font-medium">概述</a>
                    <a href="#mechanism" class="nav-link text-slate-700 hover:text-indigo-600 font-medium">代理机制</a>
                    <a href="#scenarios" class="nav-link text-slate-700 hover:text-indigo-600 font-medium">适用场景</a>
                    <a href="#performance" class="nav-link text-slate-700 hover:text-indigo-600 font-medium">性能对比</a>
                    <a href="#examples" class="nav-link text-slate-700 hover:text-indigo-600 font-medium">代码示例</a>
                </nav>
                <button class="md:hidden text-slate-700">
                    <i class="fas fa-bars text-xl"></i>
                </button>
            </div>
        </div>
    </header>

    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6 flex flex-col items-center text-center">
            <h1 class="text-4xl md:text-5xl font-bold mb-6">Java动态代理技术深度解析</h1>
            <p class="text-xl md:text-2xl max-w-3xl leading-relaxed mb-8">探索JDK动态代理与CGLIB代理的核心差异及最佳实践</p>
            <div class="flex flex-wrap justify-center gap-4">
                <a href="#intro" class="px-6 py-3 bg-white text-indigo-600 font-medium rounded-full hover:bg-indigo-50 transition-colors">
                    <i class="fas fa-book-open mr-2"></i>开始阅读
                </a>
                <a href="#examples" class="px-6 py-3 bg-indigo-700 text-white font-medium rounded-full hover:bg-indigo-800 transition-colors">
                    <i class="fas fa-code mr-2"></i>查看示例
                </a>
            </div>
        </div>
    </section>

    <section id="intro" class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto">
                <h2 class="text-3xl font-bold text-center mb-12 text-slate-800">Java代理机制概述</h2>
                <div class="drop-cap mb-6 text-slate-700 text-lg leading-relaxed">
                    在Java生态系统中，代理模式是一种强大的设计模式，它允许我们在不修改原始对象代码的情况下，通过一个代理对象来控制对原始对象的访问。JDK动态代理和CGLIB代理是Java中最常用的两种代理实现技术，它们各自有着独特的实现原理和适用场景。
                </div>
                <p class="mb-6 text-slate-700 text-lg leading-relaxed">
                    理解这两种代理技术的差异对于Java开发者来说至关重要，尤其是在使用Spring等框架时，框架会根据目标对象的特点自动选择适合的代理方式。本文将深入分析这两种技术的核心区别，并通过实际代码示例展示它们的使用方法。
                </p>
                
                <div class="my-12">
                    <div class="divider my-8"></div>
                    <div class="flex justify-center">
                        <div class="max-w-3xl text-center">
                            <i class="fas fa-lightbulb text-4xl text-yellow-500 mb-4"></i>
                            <blockquote class="text-xl italic text-slate-600">
                                "代理模式是AOP(面向切面编程)的基石，理解代理机制是掌握高级Java开发的必经之路"
                            </blockquote>
                        </div>
                    </div>
                    <div class="divider my-8"></div>
                </div>
            </div>
        </div>
    </section>

    <section id="mechanism" class="py-16 bg-slate-50">
        <div class="container mx-auto px-6">
            <h2 class="text-3xl font-bold text-center mb-12 text-slate-800">1. 代理机制对比</h2>
            
            <div class="grid md:grid-cols-2 gap-8 max-w-5xl mx-auto">
                <div class="feature-card bg-white p-8">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 rounded-full bg-indigo-100 flex items-center justify-center mr-4">
                            <i class="fas fa-project-diagram text-indigo-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-slate-800">JDK动态代理</h3>
                    </div>
                    <ul class="space-y-3 text-slate-700">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                            <span>基于接口实现的代理机制</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                            <span>通过<code>java.lang.reflect.Proxy</code>类生成代理对象</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                            <span>代理对象实现目标接口并转发方法调用</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                            <span>使用<code>InvocationHandler</code>处理方法拦截</span>
                        </li>
                    </ul>
                </div>
                
                <div class="feature-card bg-white p-8">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 rounded-full bg-purple-100 flex items-center justify-center mr-4">
                            <i class="fas fa-sitemap text-purple-600 text-xl"></i>
                        </div>
                        <h3 class="text-xl font-bold text-slate-800">CGLIB代理</h3>
                    </div>
                    <ul class="space-y-3 text-slate-700">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-purple-500 mt-1 mr-2"></i>
                            <span>基于类继承的代理机制</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-purple-500 mt-1 mr-2"></i>
                            <span>通过<code>Enhancer</code>类生成代理对象</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-purple-500 mt-1 mr-2"></i>
                            <span>代理类继承目标类并重写方法</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-purple-500 mt-1 mr-2"></i>
                            <span>使用<code>MethodInterceptor</code>处理方法拦截</span>
                        </li>
                    </ul>
                </div>
            </div>

            <div class="mt-16 max-w-5xl mx-auto">
                <div class="mermaid">
                    graph TD
                        A[Java代理机制] --> B[JDK动态代理]
                        A --> C[CGLIB代理]
                        B --> D[基于接口]
                        B --> E[Proxy类]
                        B --> F[InvocationHandler]
                        C --> G[基于继承]
                        C --> H[Enhancer类]
                        C --> I[MethodInterceptor]
                        D --> J[需要目标类实现接口]
                        G --> K[不需要实现接口]
                        E --> L[运行时生成代理类]
                        H --> M[运行时生成子类]
                </div>
            </div>
        </div>
    </section>

    <section id="scenarios" class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <h2 class="text-3xl font-bold text-center mb-12 text-slate-800">2. 适用场景分析</h2>
            
            <div class="max-w-4xl mx-auto">
                <div class="grid md:grid-cols-2 gap-8 mb-12">
                    <div class="bg-indigo-50 p-6 rounded-xl">
                        <h3 class="text-xl font-bold text-indigo-800 mb-4 flex items-center">
                            <i class="fas fa-plug mr-3"></i>JDK动态代理适用场景
                        </h3>
                        <ul class="space-y-3 text-slate-700">
                            <li class="flex items-start">
                                <div class="w-6 h-6 rounded-full bg-indigo-100 flex items-center justify-center mr-2 flex-shrink-0">
                                    <i class="fas fa-check text-indigo-500 text-xs"></i>
                                </div>
                                <span>目标类已经实现了接口</span>
                            </li>
                            <li class="flex items-start">
                                <div class="w-6 h-6 rounded-full bg-indigo-100 flex items-center justify-center mr-2 flex-shrink-0">
                                    <i class="fas fa-check text-indigo-500 text-xs"></i>
                                </div>
                                <span>需要轻量级的代理解决方案</span>
                            </li>
                            <li class="flex items-start">
                                <div class="w-6 h-6 rounded-full bg-indigo-100 flex items-center justify-center mr-2 flex-shrink-0">
                                    <i class="fas fa-check text-indigo-500 text-xs"></i>
                                </div>
                                <span>项目限制不能引入额外依赖</span>
                            </li>
                        </ul>
                    </div>
                    
                    <div class="bg-purple-50 p-6 rounded-xl">
                        <h3 class="text-xl font-bold text-purple-800 mb-4 flex items-center">
                            <i class="fas fa-cogs mr-3"></i>CGLIB代理适用场景
                        </h3>
                        <ul class="space-y-3 text-slate-700">
                            <li class="flex items-start">
                                <div class="w-6 h-6 rounded-full bg-purple-100 flex items-center justify-center mr-2 flex-shrink-0">
                                    <i class="fas fa-check text-purple-500 text-xs"></i>
                                </div>
                                <span>目标类没有实现任何接口</span>
                            </li>
                            <li class="flex items-start">
                                <div class="w-6 h-6 rounded-full bg-purple-100 flex items-center justify-center mr-2 flex-shrink-0">
                                    <i class="fas fa-check text-purple-500 text-xs"></i>
                                </div>
                                <span>需要代理具体类而非接口</span>
                            </li>
                            <li class="flex items-start">
                                <div class="w-6 h-6 rounded-full bg-purple-100 flex items-center justify-center mr-2 flex-shrink-0">
                                    <i class="fas fa-check text-purple-500 text-xs"></i>
                                </div>
                                <span>可以接受额外的字节码操作开销</span>
                            </li>
                        </ul>
                    </div>
                </div>
                
                <div class="bg-slate-50 p-6 rounded-xl border border-slate-200">
                    <h3 class="text-xl font-bold text-slate-800 mb-4 flex items-center">
                        <i class="fas fa-exclamation-triangle text-yellow-500 mr-3"></i>重要限制
                    </h3>
                    <div class="grid md:grid-cols-2 gap-6">
                        <div class="flex items-start">
                            <div class="w-8 h-8 rounded-full bg-red-100 flex items-center justify-center mr-3 flex-shrink-0">
                                <i class="fas fa-times text-red-500"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-slate-800">JDK动态代理限制</h4>
                                <p class="text-slate-700 mt-1">不能代理final类或final方法<br>目标类必须实现至少一个接口</p>
                            </div>
                        </div>
                        <div class="flex items-start">
                            <div class="w-8 h-8 rounded-full bg-red-100 flex items-center justify-center mr-3 flex-shrink-0">
                                <i class="fas fa-times text-red-500"></i>
                            </div>
                            <div>
                                <h4 class="font-bold text-slate-800">CGLIB代理限制</h4>
                                <p class="text-slate-700 mt-1">不能代理final类或final方法<br>需要引入额外依赖</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section id="performance" class="py-16 bg-slate-50">
        <div class="container mx-auto px-6">
            <h2 class="text-3xl font-bold text-center mb-12 text-slate-800">3. 性能对比</h2>
            
            <div class="max-w-4xl mx-auto">
                <div class="bg-white p-8 rounded-xl shadow-sm">
                    <div class="mermaid">
                        barChart
                            title 代理创建性能对比
                            x-axis 操作
                            y-axis 时间(ms)
                            bar "JDK代理创建" : 120
                            bar "CGLIB代理创建" : 250
                            bar "JDK方法调用" : 50
                            bar "CGLIB方法调用" : 80
                    </div>
                    
                    <div class="mt-8 grid md:grid-cols-2 gap-8">
                        <div>
                            <h3 class="text-xl font-bold text-indigo-800 mb-4">JDK动态代理性能特点</h3>
                            <ul class="space-y-3 text-slate-700">
                                <li class="flex items-start">
                                    <i class="fas fa-bolt text-indigo-500 mt-1 mr-2"></i>
                                    <span>代理创建速度较快</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-bolt text-indigo-500 mt-1 mr-2"></i>
                                    <span>方法调用开销较小</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-bolt text-indigo-500 mt-1 mr-2"></i>
                                    <span>内存占用较低</span>
                                </li>
                            </ul>
                        </div>
                        
                        <div>
                            <h3 class="text-xl font-bold text-purple-800 mb-4">CGLIB代理性能特点</h3>
                            <ul class="space-y-3 text-slate-700">
                                <li class="flex items-start">
                                    <i class="fas fa-tachometer-alt text-purple-500 mt-1 mr-2"></i>
                                    <span>代理创建需要更多时间</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-tachometer-alt text-purple-500 mt-1 mr-2"></i>
                                    <span>方法调用开销略大</span>
                                </li>
                                <li class="flex items-start">
                                    <i class="fas fa-tachometer-alt text-purple-500 mt-1 mr-2"></i>
                                    <span>首次加载可能较慢</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                    
                    <div class="mt-8 bg-yellow-50 border-l-4 border-yellow-400 p-4">
                        <div class="flex">
                            <div class="flex-shrink-0">
                                <i class="fas fa-info-circle text-yellow-500"></i>
                            </div>
                            <div class="ml-3">
                                <p class="text-sm text-yellow-700">
                                    <strong>注意：</strong> 实际性能差异取决于具体使用场景和JVM优化。对于大多数应用来说，这种性能差异可以忽略不计，应优先考虑功能需求。
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <section id="examples" class="py-16 bg-white">
        <div class="container mx-auto px-6">
            <h2 class="text-3xl font-bold text-center mb-12 text-slate-800">4. 代码示例</h2>
            
            <div class="max-w-5xl mx-auto">
                <div class="grid md:grid-cols-2 gap-8">
                    <div>
                        <div class="flex items-center mb-4">
                            <div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center mr-3">
                                <i class="fas fa-code text-indigo-600"></i>
                            </div>
                            <h3 class="text-xl font-bold text-slate-800">JDK动态代理示例</h3>
                        </div>
                        <div class="code-block p-4 overflow-x-auto">
                            <pre class="text-sm text-slate-200"><code>import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class JdkDynamicProxyDemo {
    public interface Hello {
        void sayHello();
    }

    public static class HelloImpl implements Hello {
        @Override
        public void sayHello() {
            System.out.println("你好，世界！");
        }
    }

    public static class MyInvocationHandler implements InvocationHandler {
        private final Object target;

        public MyInvocationHandler(Object target) {
            this.target = target;
        }

        @Override
        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            System.out.println("方法调用前");
            Object result = method.invoke(target, args);
            System.out.println("方法调用后");
            return result;
        }
    }

    public static void main(String[] args) {
        Hello hello = new HelloImpl();
        Hello proxy = (Hello) Proxy.newProxyInstance(
                hello.getClass().getClassLoader(),
                hello.getClass().getInterfaces(),
                new MyInvocationHandler(hello)
        );
        proxy.sayHello();
    }
}</code></pre>
                        </div>
                    </div>
                    
                    <div>
                        <div class="flex items-center mb-4">
                            <div class="w-10 h-10 rounded-full bg-purple-100 flex items-center justify-center mr-3">
                                <i class="fas fa-code text-purple-600"></i>
                            </div>
                            <h3 class="text-xl font-bold text-slate-800">CGLIB代理示例</h3>
                        </div>
                        <div class="code-block p-4 overflow-x-auto">
                            <pre class="text-sm text-slate-200"><code>import org.springframework.cglib.proxy.Enhancer;
import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class CglibProxyDemo {
    public static class Hello {
        public void sayHello() {
            System.out.println("你好，世界！");
        }
    }

    public static class MyMethodInterceptor implements MethodInterceptor {
        private final Object target;

        public MyMethodInterceptor(Object target) {
            this.target = target;
        }

        @Override
        public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
            System.out.println("方法调用前");
            Object result = proxy.invoke(target, args);
            System.out.println("方法调用后");
            return result;
        }
    }

    public static void main(String[] args) {
        Hello hello = new Hello();
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(Hello.class);
        enhancer.setCallback(new MyMethodInterceptor(hello));
        Hello proxy = (Hello) enhancer.create();
        proxy.sayHello();
    }
}</code></pre>
                        </div>
                    </div>
                </div>
                
                <div class="mt-12 bg-indigo-50 p-6 rounded-xl">
                    <div class="flex items-center mb-4">
                        <div class="w-10 h-10 rounded-full bg-white flex items-center justify-center mr-3 shadow">
                            <i class="fas fa-lightbulb text-indigo-600"></i>
                        </div>
                        <h3 class="text-xl font-bold text-indigo-800">Spring框架中的代理选择</h3>
                    </div>
                    <p class="text-slate-700 mb-4">
                        在Spring框架中，当使用基于代理的AOP时，框架会根据目标对象自动选择代理方式：
                    </p>
                    <ul class="space-y-2 text-slate-700">
                        <li class="flex items-start">
                            <div class="w-5 h-5 rounded-full bg-indigo-100 flex items-center justify-center mr-2 mt-0.5 flex-shrink-0">
                                <i class="fas fa-check text-indigo-500 text-xs"></i>
                            </div>
                            <span>如果目标对象实现了接口，Spring默认使用JDK动态代理</span>
                        </li>
                        <li class="flex items-start">
                            <div class="w-5 h-5 rounded-full bg-purple-100 flex items-center justify-center mr-2 mt-0.5 flex-shrink-0">
                                <i class="fas fa-check text-purple-500 text-xs"></i>
                            </div>
                            <span>如果目标对象没有实现接口，Spring会使用CGLIB代理</span>
                        </li>
                        <li class="flex items-start">
                            <div class="w-5 h-5 rounded-full bg-slate-100 flex items-center justify-center mr-2 mt-0.5 flex-shrink-0">
                                <i class="fas fa-cog text-slate-500 text-xs"></i>
                            </div>
                            <span>可以通过配置强制Spring总是使用CGLIB代理</span>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </section>

    <section class="py-16 bg-slate-50">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto bg-white p-8 rounded-xl shadow-sm">
                <h2 class="text-3xl font-bold text-center mb-8 text-slate-800">总结对比</h2>
                
                <div class="overflow-x-auto">
                    <table class="min-w-full divide-y divide-slate-200">
                        <thead class="bg-slate-50">
                            <tr>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-slate-500 uppercase tracking-wider">比较项</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-indigo-500 uppercase tracking-wider">JDK动态代理</th>
                                <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-purple-500 uppercase tracking-wider">CGLIB代理</th>
                            </tr>
                        </thead>
                        <tbody class="bg-white divide-y divide-slate-200">
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900">代理机制</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">基于接口</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">基于继承</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900">目标类要求</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">必须实现接口</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">可以是具体类</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900">final限制</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">不能代理final类/方法</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">不能代理final类/方法</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900">性能特点</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">创建和调用较快</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">创建稍慢，调用略慢</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900">依赖</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">JDK自带</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">需要额外库</td>
                            </tr>
                            <tr>
                                <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-slate-900">Spring默认</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">有接口时使用</td>
                                <td class="px-6 py-4 whitespace-nowrap text-sm text-slate-700">无接口时使用</td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                
                <div class="mt-8 bg-indigo-50 p-6 rounded-lg">
                    <h3 class="text-xl font-bold text-indigo-800 mb-4">选择建议</h3>
                    <p class="text-slate-700 mb-4">
                        在大多数情况下，应该优先考虑让目标类实现接口并使用JDK动态代理，这是更符合面向接口编程原则的做法。只有在无法修改目标类(如使用第三方库)或目标类确实不应该实现接口时，才考虑使用CGLIB代理。
                    </p>
                    <p class="text-slate-700">
                        在使用Spring框架时，通常不需要手动选择代理方式，框架会根据目标对象的特性自动选择最合适的代理机制。
                    </p>
                </div>
            </div>
        </div>
    </section>

    <footer class="bg-slate-900 text-white py-12">
        <div class="container mx-auto px-6">
            <div class="flex flex-col items-center">
                <div class="text-xl font-bold mb-4">技术小馆</div>
                <a href="http://www.yuque.com/jtostring" class="text-slate-300 hover:text-white transition-colors">http://www.yuque.com/jtostring</a>
                <div class="mt-6 flex space-x-4">
                    <a href="#" class="w-10 h-10 rounded-full bg-slate-700 flex items-center justify-center hover:bg-indigo-600 transition-colors">
                        <i class="fab fa-github"></i>
                    </a>
                    <a href="#" class="w-10 h-10 rounded-full bg-slate-700 flex items-center justify-center hover:bg-blue-500 transition-colors">
                        <i class="fab fa-twitter"></i>
                    </a>
                    <a href="#" class="w-10 h-10 rounded-full bg-slate-700 flex items-center justify-center hover:bg-red-500 transition-colors">
                        <i class="fab fa-youtube"></i>
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            fontFamily: 'Noto Sans SC, sans-serif',
            gantt: {
                barHeight: 30
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```